<?php
require_once("vcl/vcl.inc.php");
require_once("lib/db_connection.php");
//Includes
use_unit("components4phpfull/jtsitetheme.inc.php");
use_unit("platinumgrid/jtplatinumgrid.inc.php");
use_unit("forms.inc.php");
use_unit("extctrls.inc.php");
use_unit("stdctrls.inc.php");

//Class definition
class Engine_history extends Page
{
       public $JTEngine = null;
       public $Image1 = null;
       public $hiddenVeh = null;
       public $JTSiteTheme1 = null;
       function JTEngineShow($sender, $params)
       {
       $query1 = "select * from engine_history_tbl where veh_id='".$this->hiddenVeh->getValue()."'";
       $result = mysql_query($query1)or die(mysql_error());
       //die($query1);
       $arr = array();
       while($row = mysql_fetch_array($result))
       {
       $date = $row['timestamp'];
       $fin_date = substr($date,0,-9);

       $arr[] = array(
                        'Date Replaced' => $fin_date,
                        'Engine Number' => $row['eng_num'],
                        'Code' => $row['code'],
                        'Power' => $row['power'],
                        'Torque' => $row['torque'],
                        'Disp(ci)' => $row['disp'],
                        'Aircon' => $row['aircon'],
                        'Cylinder' => $row['cylinder']
                        );
       }

       $this->JTEngine->setCellData($arr);

       }



       function Engine_historyCreate($sender, $params)
       {
       $veh_id = $_GET['veh_id'];
       if($veh_id!='' || $veh_id!=null)
       $this->hiddenVeh->setValue($veh_id);


       }


}

global $application;

global $Engine_history;

//Creates the form
$Engine_history=new Engine_history($application);

//Read from resource file
$Engine_history->loadResource(__FILE__);

//Shows the form
$Engine_history->show();

?>